FROM base_auqf

ENV PIPENV_VENV_IN_PROJECT=1 ali_mirror="https://mirrors.aliyun.com/pypi/simple/"


WORKDIR /opt/cmdb
COPY ./ /opt/cmdb
COPY docker/docker-entrypoint.sh /usr/bin/

RUN chmod a+x /usr/bin/docker-entrypoint.sh &&\
    python3 -m pip install -U pip -i $ali_mirror &&\
    pip3 config set global.index-url $ali_mirror &&\
    pip3 install uwsgi &&\
    if [ -s "requirements.txt" ]; then pip3 install -r requirements.txt; elif [ -s "Pipfile" ]; then pip3 install pipenv && pipenv install --system; else echo "can not install the depends module" && exit; fi &&\
    rm -rf ~/.cache/pip

EXPOSE 8090
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["uwsgi", "--ini", "uwsgi.ini"]
